package com.example.vm.controller.user;

import com.common.domain.R;
import com.example.vm.domain.entity.VideoComment;
import com.example.vm.service.ActionService;
import com.example.vm.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController("user-action")
@RequestMapping("/action/user")
public class ActionController {
    @Autowired
    private ActionService actionService;
    /**
     * 用户点赞视频
     */
    @PostMapping("/like/{id}")
    public R likeVideo(@PathVariable("id") Long id){
        actionService.likeVideo(id);
        return R.ok().msg("点赞成功");
    }
    /**
     * 用户收藏视频
     */
    @PostMapping("/collect")
    public R collectVideo(@RequestParam("videoId") Long videoId,@RequestParam("collectId") Long collectId){
        actionService.collectVideo(videoId,collectId);
        return R.ok().msg("收藏成功");
    }
    /**
     * 用户评论视频——？
     */
    @PostMapping("/comment")
    public R commentVideo(@RequestBody VideoComment videoComment){
        actionService.commentVideo(videoComment);
        return R.ok().msg("评论成功");
    }
    /**
     * 用户分享视频
     */
    @PostMapping("/share/{id}")
    public R shareVideo(@PathVariable Long id){
        actionService.shareVideo(id);
        return R.ok().msg("分享成功");
    }
}
